﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PlcUI_test.MyControls
{
    public partial class WelderStatusShow : UserControl
    {
        // private List<string> Ltext = new List<string>();
        // 之后练习更深入了再这样写，先用最简单的实现

        private string text1;
        private string text2;
        private string text3;
        private string text4;
        private string text5;
        private string text6;
        private string text7;
        private string text8;
        private string text9;
        private string text10;
        private string text11;
        private string text12;
        private string text13;
        private string text14;

        // 用笨办法一个个初始化
        #region 属性初始化

        [Description("焊机类型与编号")]

        ///<sumary>
        ///焊机类型与编号
        ///</sumary>
        public string Text1
        {
            get { return text1; }
            set { text1 = value; label1.Text = value; }
        }


        [Description("焊机通讯状态标志")]
        public string Text2
        {
            get { return text2; }
            set { text2 = value; label2.Text = value; }
        }


        [Description("引弧成功，高有效")]
        public string Text3
        {
            get { return text3; }
            set { text3 = value; label3.Text = value; }
        }


        [Description("焊机是否准备好，高有效")]
        public string Text4
        {
            get { return text4; }
            set { text4 = value; label4.Text = value; }
        }


        [Description("电流有无，高有效")]
        public string Text5
        {
            get { return text5; }
            set { text5 = value; label5.Text = value; }
        }


        [Description("焊枪开关异常，高有效")]
        public string Text6
        {
            get { return text6; }
            set { text6 = value; label6.Text = value; }
        }


        [Description("焊机热保护有效，高有效")]
        public string Text7
        {
            get { return text7; }
            set { text7 = value; label7.Text = value; }
        }


        [Description("缺水保护，高有效")]
        public string Text8
        {
            get { return text8; }
            set { text8 = value; label8.Text = value; }
        }


        [Description("实际焊接电压，0-1000对应0-100v")]
        public string Text9
        {
            get { return text9; }
            set { text9 = value; label9.Text = value; }
        }


        [Description("实际焊接电流，0-400A")]
        public string Text10
        {
            get { return text10; }
            set { text10 = value; label10.Text = value; }
        }

        [Description("热丝电源热保护，高有效")]
        public string Text11
        {
            get { return text11; }
            set { text11 = value; label11.Text = value; }
        }

        [Description("热丝电源通讯保护，高有效")]
        public string Text12
        {
            get { return text12; }
            set { text12 = value; label12.Text = value; }
        }

        [Description("实际热丝电流，0-20对应0-200A")]
        public string Text13
        {
            get { return text13; }
            set { text13 = value; label13.Text = value; }
        }

        [Description("送丝速度，0-70对应0-7m/min")]
        public string Text14
        {
            get { return text14; }
            set { text14 = value; label14.Text = value; }
        }

        #endregion

        public WelderStatusShow()
        {
            InitializeComponent();
        }

        // 获取控件文本框数量
        private int GetTextBoxNumber()
        {
            int textNumber = 0;
            foreach (Control control in this.Controls)
            {
                if (control is Label)
                {
                    textNumber++;
                }
            }
            return textNumber;
        }


        // 清除所有文本
        public void ClearAllText()
        {
            foreach(Control control in tableLayoutPanel1.Controls)
            {
                if(control is Label)
                {
                    control.Text = "";
                }
            }
        }
        


}
}
